﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
 *@Generator ->
LiHuiGang - Email:lhg133@126.com - QQ:463214570 Ver:1.1.2 *@Copyright (c) 2009 LiHuiGang
Compostion Blog:http://www.cnblogs.com/lhgstudio/ -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript">
        //****chang by jt for custom ObjectParams
        //2009-11-24
        //通过custom可以像弹出页面传递object，可以是作为参数（勾选状态保存）
        //也可以作为方法
        var W = frameElement._dlgargs.win, dlgcover = W.lhgdialog.gcover();
        function A() { return frameElement._dlgargs; } 
        
        window.focus(); window.custom = A().cus;
        window.focus(); W.tool.regdoll(window);
        document.write(W.tool.getlink('lhgdialog.css'));

        var recontze = function () {
            //    if (W.binfo.ie && !W.binfo.i7) {
            //        $('contain').style.height = document.body.offsetHeight - 2;
            //        $('contain').style.width = document.body.offsetWidth - 2;
            //    }
            //    var h = $('contain').offsetHeight; h -= $('dtit').offsetHeight;
            //    h -= $('dfoot').offsetHeight;
            //change for ie7 bug
            //if (W.binfo.ie && !W.binfo.i7) {
            // lky 修改:兼容 Firefox
            if (!W.binfo.i7) {
                if (document.body.offsetHeight == 0) {
                    // ff
                    $('contain').style.height = document.documentElement.offsetHeight - 2 + 40;
                    $('contain').style.width = document.documentElement.offsetWidth - 2;
                }
                else {
                    $('contain').style.height = document.body.offsetHeight - 2 + 40;
                    $('contain').style.width = document.body.offsetWidth - 2;
                }
                h = $('contain').offsetHeight;
                h -= $('dtit').offsetHeight;
                h -= $('dfoot').offsetHeight;
            } else if (W.binfo.i7) {
                $('contain').style.height = document.documentElement.offsetHeight - 2;
                $('contain').style.width = document.documentElement.offsetWidth - 2;

                h = $('contain').offsetHeight;
                h -= $('dtit').offsetHeight;
                h -= $('dfoot').offsetHeight;
            }
            if (h < 9) {
                h = 9;
                $('dinner').style.height = Math.max(h, 0) - 5 + 'px';
            }
            else {
                $('dinner').style.height = Math.max(h, 0) - 5 + 'px';
            }
            W.document.getElementById("dfrm").style.height = $('dinner').clientHeight +58 + "px";
        };

        var crtel = function(t, l, w, h) {
            var o = A().topw.document.createElement('div');
            W.tool.ststyle(o,
	{
	    'position': 'absolute', 'top': t + 'px', 'left': l + 'px', border: '1px solid #000',
	    'width': w + 'px', 'height': h + 'px', 'zIndex': W.config.bzi + 1, 'backgroundColor': '#666'
	});
            W.tool.stopac(o, 0.30); A().topw.document.body.appendChild(o); return o;
        };

        var drag = function() {
            var regwin = [], lacoor, curpos, tdark;

            var cluphdl = function() {
                for (var i = 0; i < regwin.length; i++) {
                    W.tool.remevt(regwin[i].document, 'mousemove', dragmovehdl);
                    W.tool.remevt(regwin[i].document, 'mouseup', draguphdl);
                }
            };

            var dragmovehdl = function(evt) {
                if (!lacoor) return;
                if (!evt) evt = W.tool.getedoc(this).parentWindow.event;

                var curcoor = { x: evt.screenX, y: evt.screenY };
                curpos =
		{
		    x: curpos.x + (curcoor.x - lacoor.x),
		    y: curpos.y + (curcoor.y - lacoor.y)
		};
                lacoor = curcoor;

                tdark.style.left = curpos.x + 'px'; tdark.style.top = curpos.y + 'px';
            };

            var draguphdl = function(evt) {
                if (!lacoor) return;
                if (!evt) evt = W.tool.getedoc(this).parentWindow.event; cluphdl();
                W.tool.remnode(tdark); lacoor = null; tdark = null;
                W.tool.ststyle(frameElement, { top: curpos.y + 'px', left: curpos.x + 'px' });
            };

            return {
                downhdl: function(evt) {
                    var view = null;
                    if (!evt) { view = W.tool.getedoc(this).parentWindow; evt = view.event; } else view = evt.view;
                    var tget = evt.srcElement || evt.target; if (tget.id == 'xbtn') return;

                    var fw = frameElement.offsetWidth, fh = frameElement.offsetHeight;
                    curpos = { x: frameElement.offsetLeft, y: frameElement.offsetTop };
                    lacoor = { x: evt.screenX, y: evt.screenY }; tdark = crtel(curpos.y, curpos.x, fw, fh);

                    for (var i = 0; i < regwin.length; i++) {
                        W.tool.addevt(regwin[i].document, 'mousemove', dragmovehdl);
                        W.tool.addevt(regwin[i].document, 'mouseup', draguphdl);
                    }

                    if (evt.preventDefault) evt.preventDefault(); else evt.returnValue = false;
                },

                reghdl: function(w) { regwin.push(w); }
            };
        } ();

        var resize = function () {
            var regwin = [], lacoor, curpos, tdark, frsize = {};

            var movehdl = function (evt) {
                if (!lacoor) return;
                if (!evt) evt = W.tool.getedoc(this).parentWindow.event;

                var curcoor = { x: evt.screenX, y: evt.screenY };
                frsize = { w: curcoor.x - lacoor.x, h: curcoor.y - lacoor.y };
                if (frsize.w < 200 || frsize.h < 100) { frsize.w = 200; frsize.h = 100 };

                W.tool.ststyle(tdark, { width: frsize.w + 'px', height: frsize.h + 'px', top: curpos.y + 'px', left: curpos.x + 'px' });
            };

            var uphdl = function (evt) {
                if (!lacoor) return;
                if (!evt) evt = W.tool.getedoc(this).parentWindow.event;

                for (var i = 0; i < regwin.length; i++) {
                    W.tool.remevt(regwin[i].document, 'mousemove', movehdl);
                    W.tool.remevt(regwin[i].document, 'mouseup', uphdl);
                }

                W.tool.ststyle(frameElement, { width: frsize.w + 'px', height: frsize.h + 'px' });
                recontze(); W.tool.remnode(tdark); lacoor = null; tdark = null;
                if (W.binfo.ie && !W.binfo.i7 && $('frmain')) { 
                    //$('frmain').height = $('dinner').style.height;
                }
            };

            return {
                downhdl: function (evt) {
                    var view = null;
                    if (!evt) { view = W.tool.getedoc(this).parentWindow; evt = view.event; } else view = evt.view;

                    var fw = frameElement.offsetWidth, fh = frameElement.offsetHeight;
                    curpos = { x: frameElement.offsetLeft, y: frameElement.offsetTop };
                    lacoor = { x: evt.screenX - fw, y: evt.screenY - fh }; tdark = crtel(curpos.y, curpos.x, fw, fh);

                    for (var i = 0; i < regwin.length; i++) {
                        W.tool.addevt(regwin[i].document, 'mousemove', movehdl);
                        W.tool.addevt(regwin[i].document, 'mouseup', uphdl);
                    }

                    if (evt.preventDefault) evt.preventDefault(); else evt.returnValue = false;
                },

                reghdl: function (w) { regwin.push(w); }
            };
        } ();

        (function() {
            window.onload = function() {
                recontze(); loadbtnevt(); $('throbber').style.visibility = ''; loadinnfrm();
                if (W.binfo.ie) window.document.onmousedown = setop; else window.onmousedown = setop;
                $('dtit').onmousedown = drag.downhdl; drag.reghdl(window); drag.reghdl(A().topw); drag.reghdl(W);
                $('dark').onmousedown = resize.downhdl; resize.reghdl(window); resize.reghdl(A().topw); resize.reghdl(W);
                if (A().link) $('throbber').style.visibility = 'hidden'; W.tool.disctmenu(document);
                if (A().html && typeof custom == 'function') custom();
            };

            var setop = function(evt) {
                if (!evt) evt = event || this.parentWindow.event;
                W.tool.ststyle(frameElement, { 'zIndex': parseInt(W.config.bzi, 10) + 1 });
                W.config.bzi = frameElement.style.zIndex; evt.cancelBubble = true;
            };

            var loadinnfrm = function() {
                if (A().link == 'hcode') { $('dinner').innerHTML = A().page; }
                else {
                    var sy = A().link ? '' : ' style="visibility:hidden;" ';
                    $('dinner').innerHTML = '<iframe id="frmain" src="' + A().page + '" name="frmain" frameborder="0" ' +
									'width="100%" height="100%"  scrolling="auto"' + sy + 'allowtransparency="true"><\/iframe>';
                }

                // 弹出框高度自适应
                if (window.addEventListener){$('frmain').addEventListener("load", function(){
                    // 非 IE
//                    var obj = $('frmain');
//                    var bodyH,bodyW;
//                    var children = obj.contentWindow.document.body.children;
//                    if(children.length > 0)
//                        bodyH = children[0].clientHeight;
//                        bodyW = children[0].clientWidth;
//                    $('frmain').document.getElementById("dinner").style.height = bodyH + 0 + "px";
//                    $('frmain').document.getElementById("dinner").style.weight = bodyW + 0 + "px";
//                    $('frmain').style.height = bodyH + 100;
//                    $('frmain').style.weight = bodyW + 100;
//                    window.parent.document.getElementById("dfrm").style.height = bodyH + 200 + "px";
//                    window.parent.document.getElementById("dfrm").style.weight = bodyW + 200 + "px";
                }, false);}
                else if (window.attachEvent){$('frmain').attachEvent("onload", function(){
                    // IE
                }); }

            };

            window.loadinndlg = function() {
                if (!frameElement.parentNode) return null;
                var frmain = $('frmain'), innwin = frmain.contentWindow, inndoc = innwin.document;
                $('throbber').style.visibility = 'hidden'; frmain.style.visibility = '';
                if (W.binfo.ie) inndoc.onmousedown = setop; else innwin.onmousedown = setop;
                drag.reghdl(innwin); resize.reghdl(innwin); innwin.focus(); return W;
            };

            window.cancel = function() { return closedlg(); };
            window.setReturnVal = function(v) {
                var ret = document.getElementById("returnVal");
                ret.value = v;
            };
            window.closedlg = function() {
                if ($('frmain')) $('frmain').src = W.tool.getvoid();
                $('throbber').style.visibility = 'hidden';
                W.lhgdialog.closdlg(window, dlgcover);
            };

            window.cancel2 = function() { return closedlg2('callb'); };
            window.closedlg2 = function(callb) {
                if ($('frmain')) $('frmain').src = W.tool.getvoid();
                $('throbber').style.visibility = 'hidden';
                W.lhgdialog.closdlg2(window, dlgcover, callb);
            };
            var loadbtnevt = function() {
                if (W.binfo.ie) { var img = new Image(); img.src = "@Images/btn_bg.gif"; }; crebtn('cbtn', '关 闭', cancel2);
                $('txt').innerHTML = A().tit; $('xbtn').onmouseover = function() { this.style.backgroundPosition = '0 0'; };
                $('xbtn').onmouseout = function() { this.style.backgroundPosition = '-22px 0'; }; $('xbtn').onclick = cancel2;
            };

            window.crebtn = function(i, t, f) {
                var li = document.createElement('li'), span = document.createElement('span');
                if ($(i)) { alert('创建的' + t + '按钮的id已存在！'); return false; };
                li.id = i; span.innerHTML = t; li.appendChild(span);
                li.onmouseover = function() { this.style.backgroundPosition = '0 -42px'; };
                li.onmouseout = function() { this.style.backgroundPosition = '0 -21px'; };
                W.tool.addevt(li, 'click', f); $('btns').appendChild(li); li = span = null;
            };

            window.rembtn = function(id) { if ($(id)) $('btns').removeChild($(id)); };
        })();
    </script>

    <style type="text/css">
        html
        {
            background-color: #E4F2FC;
        }
    </style>
</head>
<body>
    <div id="contain" class="contain">
        <div id="dtit" class="dlgtit">
            <span id="txt"></span>
            <div id="xbtn">
            </div>
        </div>
        <div id="dinner" class="dlginner">
        </div>
        <div id="dfoot" class="dlgfoot">
            <ul id="btns">
                <li id="dark"></li>
            </ul>
        </div>
    </div>
    <div id="throbber" style="position: absolute; visibility: hidden;">
        正在加载窗口内容，请稍等....
    </div>
    <input id="returnVal" name="returnVal" style="display: none" />
</body>
</html>
